package org.example.browser;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.util.List;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:TQ02
 * Data:2024-06-03
 * Time:10:46
 * Text：
 */
public class Element {
    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.setBinary("D:\\Chrome\\chrome.exe");
        options.addArguments("--remote-allow-origins=*");
        WebDriver driver = new ChromeDriver(options);
        driver.get("https://www.baidu.com");
        //获取input
        List<WebElement> t1 = driver.findElements(By.cssSelector("input"));
        for(WebElement element:t1){
            if(element.getAttribute("type").equals("checkbox")){
                element.click();
            }
        }
    }
}
